package com.iran.visitor.example;

import com.iran.visitor.Element;
import com.iran.visitor.Visitor;

import java.util.ArrayList;
import java.util.List;

public class ObjectStructure {
    private List<Person> list = new ArrayList<>();

    public void add(Person element){
        list.add(element);
    }
    public void remove(Person element){
        list.remove(element);
    }
    public void accept(State visitor){
        list.forEach(d->{
            d.acceptState(visitor);
        });
    }
}
